home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / lisp / games / yow.el < prev    next >
Encoding:
Text File  |  1995-03-25  |  2.7 KB  |  92 lines

  1. ;;; yow.el --- quote random zippyisms
  2.  
  3. ;; Copyright (C) 1985, 1993, 1994 Free Software Foundation, Inc.
  4.  
  5. ;; Maintainer: FSF
  6. ;; Keywords: games
  7.  
  8. ;; This file is part of XEmacs.
  9.  
  10. ;; XEmacs is free software; you can redistribute it and/or modify it
  11. ;; under the terms of the GNU General Public License as published by
  12. ;; the Free Software Foundation; either version 2, or (at your option)
  13. ;; any later version.
  14.  
  15. ;; XEmacs is distributed in the hope that it will be useful, but
  16. ;; WITHOUT ANY WARRANTY; without even the implied warranty of
  17. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  18. ;; General Public License for more details.
  19.  
  20. ;; You should have received a copy of the GNU General Public License
  21. ;; along with XEmacs; see the file COPYING.  If not, write to the Free
  22. ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  23.  
  24. ;;; Commentary:
  25.  
  26. ;; Important pinheadery for GNU Emacs.
  27. ;;
  28. ;; See cookie1.el for implementation.  Note --- the `n' argument of yow
  29. ;; from the 18.xx implementation is no longer; we only support *random*
  30. ;; random access now.
  31.  
  32. ;;; Code:
  33.  
  34. (require 'cookie1)
  35.  
  36. (defvar yow-file (concat data-directory "yow.lines")
  37.    "File containing Pertinent Pinhead Phrases.")
  38.  
  39. ;;;###autoload
  40. (defun yow (&optional insert)
  41.   "Return or display a random Zippy quotation.  With prefix arg, insert it."
  42.   (interactive "P")
  43.   (let ((yow (cookie
  44.           yow-file
  45.               "Am I CONSING yet?..." "I have SEEN the CONSING!!")))
  46.     (cond (insert
  47.        (insert yow))
  48.       ((not (interactive-p))
  49.            yow)
  50.           ((not (string-match "\n" yow))
  51.        (delete-windows-on (get-buffer-create "*Help*"))
  52.        (message "%s" yow))
  53.       (t
  54.        (message "Yow!")
  55.        (with-output-to-temp-buffer "*Help*"
  56.          (princ yow))))))
  57.  
  58. (defun read-zippyism (prompt &optional require-match)
  59.   "Read a Zippyism from the minibuffer with completion, prompting with PROMPT.
  60. If optional second arg is non-nil, require input to match a completion."
  61.   (read-cookie prompt yow-file
  62.            "Am I CONSING yet?..." "I have SEEN the CONSING!!"
  63.            require-match))
  64. ;;;###autoload
  65. (defun insert-zippyism (&optional zippyism)
  66.   "Prompt with completion for a known Zippy quotation, and insert it at point."
  67.   (interactive (list (read-zippyism "Pinhead wisdom: " t)))
  68.   (insert zippyism))
  69.  
  70. ; Yowza!! Feed zippy quotes to the doctor. Watch results.
  71. ; fun, fun, fun. Entertainment for hours...
  72. ;
  73. ; written by Kayvan Aghaiepour
  74.  
  75. ;;;###autoload
  76. (defun psychoanalyze-pinhead ()
  77.   "Zippy goes to the analyst."
  78.   (interactive)
  79.   (doctor)                ; start the psychotherapy
  80.   (message nil)
  81.   (switch-to-buffer "*doctor*")
  82.   (sit-for 0)
  83.   (while (not (input-pending-p))
  84.     (insert (yow))
  85.     (sit-for 0)
  86.     (doctor-ret-or-read 1)
  87.     (doctor-ret-or-read 1)))
  88.  
  89. (provide 'yow)
  90.  
  91. ;;; yow.el ends here
  92.